<style type="text/css">
    table {
        max-width: 750px;
    }
</style>
<div style="min-height: 400px;">
    <table id="listkegiatan" style="margin-top: 1em;">
        <thead>
            <tr>
                <th>Waktu Posting</th>
                <th>Judul Kegiatan</th>
                <th>Lokasi</th>
                <th>Tanggal Kegiatan</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            <?php
            if (count($kegiatanList) > 0) {
                foreach ($kegiatanList as $kegiatan) {
                    echo "<tr>";
                    echo "<td style='text-align: right;'>" . $kegiatan->content_id->posted_date . "<br />" . $kegiatan->content_id->posted_time . "</td>";
                    echo "<td>" . "<a href='" . site_url("kegiatan/detail/" . $kegiatan->id) . "'>" . $kegiatan->content_id->title . "</a>" . "</td>";
                    echo "<td>" . $kegiatan->location . "</td>";
                    echo "<td>" . $kegiatan->start_date . " s/d " . $kegiatan->end_date . "</td>";
                    echo "<td>" . ($kegiatan->is_approved ? "Approved" : "Pending Approval") . "</td>";
                    echo "</tr>";
                }
            } else {
                echo "<tr>";
                echo "<td style='text-align: center;' colspan='5'>" . "(tidak ada history entry kegiatan)" . "</td>";
                echo "</tr>";
            }
            ?>
        </tbody>
    </table>

    <h1 class="title">History Entry Berita Kegiatan</h1>

    <table id="listberita" style="margin-top: 1em;">
        <thead>
            <tr>
                <th>Waktu Posting</th>
                <th>Judul Berita</th>
                <th>Kegiatan</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            <?php
            if (count($beritaList) > 0) {
                foreach ($beritaList as $berita) {
                    echo "<tr>";
                    echo "<td style='text-align: right;'>" . $berita->content_id->posted_date . "<br />" . $berita->content_id->posted_time . "</td>";
                    echo "<td>" . "<a href='" . site_url("kegiatan/detail/" . $berita->activity_id->id . "/" . $berita->id) . "'>" . $berita->content_id->title . "</a>" . "</td>";
                    echo "<td>" . "<a href='" . site_url("kegiatan/detail/" . $berita->activity_id->id) . "'>" . $berita->activity_id->content_id->title . "</a>" . "</td>";
                    echo "<td>" . ($berita->is_approved ? "Approved" : "Pending Approval") . "</td>";
                    echo "</tr>";
                }
            } else {
                echo "<tr>";
                echo "<td style='text-align: center;' colspan='5'>" . "(tidak ada history entry berita)" . "</td>";
                echo "</tr>";
            }
            ?>
        </tbody>
    </table>
</div>